#include "stdafx.h"
#include "wf_dimaligned.h"

#include "pf_snapper.h"
#include "pf_constructionline.h"
#include "pf_dialogfactory.h"



WF_Dimension::WF_Dimension(const char* name,
                                       PF_Container& container,
                                       PF_GraphicView& graphicView)
        :PF_PreviewActionInterface(name,
                           container, graphicView) {

    reset();
}



WF_Dimension::~WF_Dimension() {}



void WF_Dimension::reset() {
    data = PF_DimensionAttribute(PF_Vector(false),
                            PF_Vector(false),
                            LX_Define::VAlignMiddle,
                            LX_Define::HAlignCenter,
                            LX_Define::Exact,
                            1.0,
                            "",
                            "Standard",
                            0.0);
	diameter = false;
}



void WF_Dimension::init(int status) {
    PF_PreviewActionInterface::init(status);
    //reset();
}



void WF_Dimension::hideOptions() {
    PF_ActionInterface::hideOptions();

    if (PF_DIALOGFACTORY!=NULL) {
        PF_DIALOGFACTORY->requestOptions(this, false);
    }
}



void WF_Dimension::showOptions() {
    PF_ActionInterface::showOptions();

    if (PF_DIALOGFACTORY!=NULL) {
        PF_DIALOGFACTORY->requestOptions(this, true, true);
    }
}



void WF_Dimension::updateMouseCursor() {
    graphicView->setMouseCursor(LX_Define::CadCursor);
}



void WF_Dimension::updateToolBar() {
    if (PF_DIALOGFACTORY!=NULL) {
        if (!isFinished()) {
            PF_DIALOGFACTORY->requestToolBar(LX_Define::ToolBarSnap);
        } else {
            PF_DIALOGFACTORY->requestToolBar(LX_Define::ToolBarDim);
        }
    }
}

// EOF
